***********
**Table 1**
***********

**Columns (1) and (2)**

*Clean data*

insheet using "1992-97 Violence and KANU Election Results.csv", clear

replace violence_akiwumi=0 if violence_akiwumi==.

*Dropping complex splits
drop if constcode_92_2!=.
drop if constcode_92_1 == 21 | constcode_92_1 == 22 | constcode_92_1 == 33 | constcode_92_1 == 35 | constcode_92_1 == 47 | constcode_92_1 == 48 | constcode_92_1 == 56 | constcode_92_1 == 59 | constcode_92_1 == 65 | constcode_92_1 == 68 | constcode_92_1 == 72 | constcode_92_1 == 73 | constcode_92_1 == 114 | constcode_92_1 == 115 | constcode_92_1 == 116 | constcode_92_1 == 134 | constcode_92_1 == 135 | constcode_92_1 == 138 | constcode_92_1 == 139 | constcode_92_1 == 165 | constcode_92_1 == 167

*Get total valid votes variable*
gen totalvalidvotes=candvotes*(100/validvotespercentage)

*Create collapsed dataset for vote share analysis*
collapse (sum) candvotes validvotes=totalvalidvotes totalcast registered (max) split anywin=win anyincumbent=incumbent violence_akiwumi (first) constname (mean) avgwin=win avgincumbent=incumbent, by(electype elecyear constcode_92_1)
gen voteshare=candvotes/validvotes
gen turnout=totalcast/registered
replace voteshare=1 if voteshare==.
replace split=1 if split==.

drop if electype=="PRESIDENTIAL"

xtset constcode_92_1 elecyear, delta(5)

*Regressions*

xtreg voteshare violence_akiwumi i.elecyear, fe

xtreg avgwin violence_akiwumi i.elecyear, fe

**Column (3)**

*Clean data*

insheet using "1992-97 Violence and KANU Election Results.csv", clear

replace violence_akiwumi=0 if violence_akiwumi==.

*Dropping complex splits
drop if constcode_92_2!=.
drop if constcode_92_1 == 21 | constcode_92_1 == 22 | constcode_92_1 == 33 | constcode_92_1 == 35 | constcode_92_1 == 47 | constcode_92_1 == 48 | constcode_92_1 == 56 | constcode_92_1 == 59 | constcode_92_1 == 65 | constcode_92_1 == 68 | constcode_92_1 == 72 | constcode_92_1 == 73 | constcode_92_1 == 114 | constcode_92_1 == 115 | constcode_92_1 == 116 | constcode_92_1 == 134 | constcode_92_1 == 135 | constcode_92_1 == 138 | constcode_92_1 == 139 | constcode_92_1 == 165 | constcode_92_1 == 167

*Get total valid votes variable*
gen totalvalidvotes=candvotes*(100/validvotespercentage)

*Create collapsed dataset for vote share analysis*
collapse (sum) candvotes validvotes=totalvalidvotes totalcast registered (max) split anywin=win anyincumbent=incumbent violence_akiwumi (first) constname (mean) avgwin=win avgincumbent=incumbent, by(electype elecyear constcode_92_1)
gen voteshare=candvotes/validvotes
gen turnout=totalcast/registered
replace voteshare=1 if voteshare==.
replace split=1 if split==.

drop if electype=="PARLIAMENTARY"

xtset constcode_92_1 elecyear, delta(5)

*Regression*

xtreg voteshare violence_akiwumi i.elecyear, fe
